package com.quanyan.assets.task;

import com.github.ltsopensource.core.commons.utils.CollectionUtils;
import com.github.ltsopensource.core.domain.JobResult;
import com.github.ltsopensource.jobclient.support.JobCompletedHandler;
import com.quanyan.common.utils.TimeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Date;
import java.util.List;

/**
 * @author xian-guo
 *
 */
public class JobCompletedHandlerImpl implements JobCompletedHandler {

    private static final Logger LOGGER = LoggerFactory.getLogger(JobCompletedHandlerImpl.class);

    /**
     * TaskJobRunner执行完成之后，执行该方法
     * @param jobResults
     */
    @Override
    public void onComplete(List<JobResult> jobResults) {
        if (CollectionUtils.isNotEmpty(jobResults)) {
            for (JobResult jobResult : jobResults) {
               LOGGER.debug(TimeUtils.getSimpleFullEngString(new Date()) + "----JobCompletedHandlerImpl--->：" + jobResult);
            }
        }
    }
}
